/**
 * 保存文章图片响应
 */
interface SaveArticleImageRes {
    code: number;
    message: string;
    data: ArticleImage;
}

/**
 * 文章图片
 */
interface ArticleImage {
    id: number;
    articleId: number;
    /**
     * 图片地址
     */
    imageUrl: string;
    imageName: string;
    tempArticleId: string | null;
    type: string;
}

export enum ArticleStatusEnum {
    APPROVED = 0,
    REJECTED = 1,
    WAIT_REVIEW = 2,
    DRAFT = 3
}

export enum ArticleTypeEnum {
    CONTENT = 0,
    COVER = 1,
}

interface Article {
    id: number | null | undefined;
    authorId: number | null | undefined;
    title: string;
    cover: string | null | undefined;
    content: string;
    // 文章状态。0：审核通过；1：审核不通过；2：待审核；3：草稿
    status: string | number | null | undefined;
    likes: number | null | undefined;
    tempId: string | null | undefined;
    createTime: string;
    updateTime: string;
}

export class SaveArticleImgReqData {
    articleId: number | null | undefined;
    tempArticleId: string;
    type: number;
    imageUrl: string | undefined | null;
    imageName: string | undefined | null;
    objectName: string | undefined | null;

    constructor(
        articleId: any = -1, // 设置默认值为 -1，可根据实际情况调整
        tempArticleId: any = '', // 设置默认值为空字符串
        type: number,
        imageUrl: string | undefined | null = '', // 设置默认值为空字符串
        imageName: string | undefined | null = '', // 设置默认值为空字符串
        objectName: string | undefined | null = '' // 设置默认值为空字符串
    ) {
        this.articleId = articleId;
        this.tempArticleId = tempArticleId;
        this.type = type;
        this.imageUrl = imageUrl;
        this.imageName = imageName;
        this.objectName = objectName;
    }
}

export type {
    SaveArticleImageRes,
    ArticleImage,
    Article,
}
